<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>{$region['title']}</title>
    <link rel="stylesheet" href="{MODULE_URL}template/mobile/style/style1/static/css/weui.css" />
    <link rel="stylesheet" type="text/css" href="{MODULE_URL}template/mobile/style/style1/static/css/region.css" />
    <script type="text/javascript" src="{$_W['siteroot']}app/resource/js/lib/jquery-1.11.1.min.js"></script>
    <style type="text/css">
    body {
        color: #777;

    }
    .weui_label {
        font-size: 14px;
        color: #a9a9a9;
        width: 5em;
    }
    .weui_input {
    font-size: 14px;
    color: #a9a9a9;
}
.weui_select{
    font-size: 14px;
    color: #a9a9a9;
}
    .add-image {
        clear: both;
        width: 96%;
        padding-left: 4%;
        height: 90px;
        background-color: #FFF;
        border-bottom: 1px solid #dfe9e8;
        border-top: 1px solid #dfe9e8;
        clear: both;
    }
    
    .fileInput {
        height: 100%;
        width: 100%;
        overflow: hidden;
        font-size: 300px;
        position: absolute;
        right: 0;
        top: 0;
        opacity: 0;
        filter: alpha(opacity=0);
        cursor: pointer;
    }
    
    .nav-ul li:hover {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
    
    .nav {
        clear: both;
        width: 100%;
    }
    
    .nav-ul {
        margin: 8px 8px 0 2px;
        overflow: hidden;
    }
    
    .nav-ul li {
        float: left;
        width: 6.1em;
        height: 6.1em;
        margin: 0.5em 1.2em 1em 0;
        box-sizing: border-box;
        position: relative;
    }
    
    .nav-ul li div {
        width: 100%;
        height: 100%;
        line-height: 32px;
        font-size: 12px;
        text-align: center;
        background:url({MODULE_URL}template/mobile/style/style1/static/image/add-img.jpg) no-repeat center;
        background-size: 100%;
    }
    
    .nav-ul li div img {
        margin: 0 !important;
        width: 100%;
        height: 100%
    }
    </style>
</head>

<body>
    <header id="header">
        <div class="header_div">
            <div id="left_div" onClick="window.location.href='{php echo $this->createMobileUrl('car',array('op' => 'list'))}'"></div>
            <div id="middle_div">
                <h1 id="title">我要拼车</h1></div>
            <div id="right_div">
                <div class="right_bottom"></div>
                <div class="right_img"></div>
            </div>
        </div>
    </header>
    <div class="cont">
        <div class="weui_cells weui_cells_form">
            <div class="weui_cell weui_cell_select weui_select_after">
                <div class="weui_label">
                    类型：
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <select class="weui_select" name="type" id='type'>
                        <option value="1">我是司机</option>
                        <option value="2">我是乘客</option>
                    </select>
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">标题：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" placeholder="请输入标题" id="tit" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">出发地：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" value="{$m['address']}" id="start_position" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">目的地：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" placeholder="请输入目的地"id="end_position" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">出发时间：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                   <input class="weui_input" type="time" value="09:00" id="gotime" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">返回时间：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="time" value="18:00" id="backtime" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">单价：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" placeholder="    (元)"id="sprice" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">提供座位：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" placeholder="    (个)" id="seat" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">姓名：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" value="{$member['realname']}" id="contact" />
                </div>
            </div>
            <div class="weui_cell">
                <div class="weui_cell_hd">
                    <label class="weui_label">手机：</label>
                </div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" value="{$member['mobile']}" id="mobile" />
                </div>
            </div>
        </div>
        <div class="bd spacing" style="text-align:center;margin-top:10px;">
            <a href="javascript:;" class="weui_btn weui_btn_primary" id="showToast" style="width:80%">提交信息</a>
        </div>
        <div id="toast" style="display: none;">
            <div class="weui_mask_transparent"></div>
            <div class="weui_toast">
                <i class="weui_icon_toast"></i>
                <p class="weui_toast_content">成功提交</p>
            </div>
        </div>
    </div>
    <script>
    $(function() {
        select('a1');
    });
    </script>
    <script type="text/javascript">
    var date = new Date();
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    if (month < 10) {
        month = "0" + month;
    }
    var day = date.getDate();
    if (day < 10) {
        day = "0" + day;
    }
    var hour = date.getHours();
    if (hour < 10) {
        hour = "0" + hour;
    }
    var minute = date.getMinutes();
    if (minute < 10) {
        minute = "0" + minute;
    }
    var second = date.getSeconds();
    if (second < 10) {
        second = "0" + second;
    }

    $("[name=time]").val(hour + ":" + minute + ":" + second);
    $(function() {
        $("#showToast").click(function(event) {
            var title = $("#tit").val();
            if (title == '') {
                alert('标题不能为空！');
                return false
            };
            var end_position = $("#end_position").val();
            if (end_position == '') {
                alert('目的地必填！');
                return false
            };
            var sprice = $("#sprice").val();
            if (sprice == '') {
                alert('单价必填！');
                return false
            };
            var seat = $("#seat").val();
            if (seat == '') {
                alert('座位必填！');
                return false
            };
            var type = $("#type").val();
            var start_position = $("#start_position").val();
            var gotime = $("#gotime").val();
            var backtime = $("#backtime").val();
            var contact = $("#contact").val();
            var mobile = $("#mobile").val();
            $.ajax({
                url: "{php echo $this->createMobileUrl('car',array('op' => 'add'))}",
                dataType: 'json',
                data: {
                    title: title,
                    end_position: end_position,
                    sprice: sprice,
                    seat: seat,
                    type: type,
                    start_position: start_position,
                    gotime: gotime,
                    backtime:backtime,
                    contact:contact,
                    mobile:mobile
                },
                success: function(s) {
                    if (s.status == 1) {
                        $('#toast').show();
                        setTimeout(function() {
                            $('#toast').hide();
                            window.location.href="{php echo $this->createMobileUrl('car',array('op' => 'list'))}";
                        }, 3000);
                    };
                }
            })


        });
    })
    </script>
    {template 'style/style1/footer'}
</body>

</html>
